/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package my.library;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author saltcoffee
 */
public class ReadFile {
    public static void main(String[] args) {
        File file1=new File("test1.txt");
    
        try {
            FileReader fr = new FileReader(file1);
            BufferedReader br=new BufferedReader(fr);
            String line="";
            int i=0;
            while((line = br.readLine()) !=null){
                System.out.println(++i +":"+line);
                }
            br.close();
            fr.close();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(ReadFile.class.getName()).log(Level.SEVERE, null, ex);
        } catch(IOException e){
            
        }
        
        
    }
}
